package com.oauth2demo.demo;

import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.scrypt.SCryptPasswordEncoder;

/**
 * <h3>oauth2Demo</h3>
 * <p>测试1</p>
 *
 * @author gdw
 * @since 2024-07-10 14:17:28
 */
public class demo1 {
    public static void main(String[] args) {
        //一个账户
        // UserDetails user = User.withDefaultPasswordEncoder()
        //         .username("xiaogu")
        //         .password("123456789")
        //         .roles("user")
        //         .build();
        // System.out.println(user.getPassword());
        //多个账户
        // User.UserBuilder users = User.withDefaultPasswordEncoder();
        // UserDetails user = users
        //         .username("user")
        //         .password("123456")
        //         .roles("USER")
        //         .build();
        // UserDetails admin = users
        //         .username("admin")
        //         .password("xiaogu123")
        //         .roles("USER","ADMIN")
        //         .build();
        // System.out.println(user.getPassword());
        // System.out.println(admin.getPassword());

        // BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(16);
        // String result = encoder.encode("myPassword");
        // boolean myPassword = encoder.matches("myPassword", result);
        // System.out.println(myPassword);
        // System.out.println(result);
    }
}
